<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="commons/common.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<!--  首页加载 -->
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><sitemesh:write property='title' /></title>
    <link href="${ctx }/css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <link href="${ctx }/css/animate.css" rel="stylesheet">
    <link href="${ctx }/css/plugins/ladda/ladda-themeless.min.css" rel="stylesheet">
    <link href="${ctx}/css/plugins/iCheck/custom.css" rel="stylesheet">
    <sitemesh:write property='head' />
</head>
<body>
<c:if test="${empty no_cookie_domain}">
  <%--  <script>
        document.domain = '${cookieDomain}';
    </script>--%>
</c:if>
<%--<body class="pace-done fixed-nav-basic fixed-sidebar">--%>
<div id="wrapper">
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav metismenu" id="side-menu">
                <li class="nav-header">
                    <div class="dropdown profile-element">
                        <div class="row">
                            <div class="col-xs-4">
                                    <span>
                                        <img id="org_logo" alt="image" class="img-circle" src="" />
                                    </span>
                            </div>
                            <div class="col-xs-8">
                                <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                        <span class="">
                                            <span class=" m-t-xs">
                                                <strong  class="font-bold">${org.organizationName}</strong>
                                            </span>
                                        </span>
                                </a>
                            </div>
                        </div>
                        <br/>
                        <a data-toggle="dropdown" class="dropdown-toggle" href="javascript:void(0)"
                           onclick="openQrcode()">
                            <span class="clear">
                                <span class="block m-t-xs">
                                    <strong class="font-bold" style="color:#36f7c7;font-size:12px;"><i
                                            class="fa fa-globe"></i> &nbsp;官网地址</strong>
                                </span>
                            </span>
                        </a>

                    </div>
                    <div class="logo-element">
                        <a data-toggle="dropdown" class="dropdown-toggle" href="javascript:void(0)"
                           onclick="openQrcode()">SAAS+</a>
                    </div>
                </li>
                <li>
                    <a href="/showUserList">
                        <i class="fa fa-dashboard"></i> <span class="nav-label">首页</span></a>
                </li>
                <li ><a href="/match/showBasicMatch">
                    <i class="fa fa-send"></i> <span class="nav-label">创建赛事</span></a></li>
                <li>
                    <a href="javascript:void(0)">
                        <i class="fa fa-road"></i> <span class="nav-label">用户</span> <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">

                        <li><a href="/showUserList"><i class="fa fa-caret-right"></i>用户列表</a></li>
                        <li><a href="/match/toRollCallList"><i class="fa fa-caret-right"></i>名单管理</a></li>
                    </ul>
                </li>
               <%-- <li>
                    <a href="javascript:void(0)"><i class="fa fa-users"></i> <span class="nav-label">团报</span> <span
                            class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li><a href="/group/toGroupList"><i class="fa fa-caret-right"></i>团队列表</a></li>
                    </ul>
                </li>
                <li>
                    <a href="javascript:void(0)"><i class="fa fa-shopping-cart"></i> <span class="nav-label">订单</span>
                        <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li><a href="/order/showOrderList"><i class="fa fa-caret-right"></i>个人订单列表</a></li>
                        <li><a href="/teamOrder/showTeamOrderList"><i class="fa fa-caret-right"></i>组队订单列表</a></li>
                        <li><a href="/groupOrder/showGroupOrderList"><i class="fa fa-caret-right"></i>拼团订单列表</a></li>
                    </ul>
                </li>
                <li>
                    <a href="javascript:void(0)"><i class="fa fa-line-chart"></i> <span class="nav-label">财务</span>
                        <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li><a href="/finance/show_my_match_income"><i class="fa fa-caret-right"></i>赛事收入</a></li>
                        <li><a href="/finance/show_settlement_log"><i class="fa fa-caret-right"></i>结算记录</a></li>
                        <li><a href="/withdraw/show_withdraw_record"><i class="fa fa-caret-right"></i>提现记录</a></li>
                        <li><a href="/finance/showFinanceList"><i class="fa fa-caret-right"></i>我的账单</a></li>
                    </ul>
                </li>

                <li >
                    <a href="javascript:void(0)"><i class="fa fa-th-large"></i> <span class="nav-label">官网</span> <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        &lt;%&ndash;<li><a href="/official/showFrame">赛事官网</a></li>&ndash;%&gt;
                        <li><a href="/official/toOfficalSiteSet">网站设置</a></li>
                        <li><a href="/official/toPageNavigation">导航设置</a></li>
                        &lt;%&ndash;<li><a href="/official/album">相册</a></li>&ndash;%&gt;
                    </ul>
                </li>

                <li >
                    <a href="javascript:void(0)"><i class="fa fa-th-large"></i> <span class="nav-label">资讯</span> <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li><a href="/official/column/showColumnList">资讯列表</a></li>
                    </ul>
                </li>
                <li >
                    <a href="javascript:void(0)"><i class="fa fa-th-large"></i> <span class="nav-label">设置</span> <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li><a href="/author/show_author_info" target="_blank">跑途账户信息</a></li>
                    </ul>
                </li>--%>
                <li >
                    <a href="javascript:void(0);" onclick="logout()"><i class="fa fa-sign-out"></i><span class="nav-label">安全登出</span></a>
                </li>
            </ul>
        </div>
    </nav>

    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top  white-bg" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header">
                    <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars" style="padding: 3px 0px;"></i> </a>
                </div>
                <ul class="nav navbar-top-links navbar-right">
                    <li>
                        <a href="http://www.runtour.com.cn/html/juhe.html" target="_blank" >
                            <span class="m-r-sm text-muted welcome-message" style="color:#C0C0C0">管理系统</span></a>
                    </li>

                    <li>
                        <a href="javascript:void(0);" onclick="logout()" >
                            <i class="fa fa-sign-out"></i> 安全登出
                        </a>
                    </li>
                </ul>
            </nav>
        </div>

        <div class="wrapper wrapper-content animated fadeInRight">
            <sitemesh:write property='body' />
        </div>
        <div class="footer">
            <div class="pull-right">
                <!--                console -->
            </div>
            <div>
                <strong>Copyright</strong> RunTour &copy; 2016-2017
            </div>
        </div>

    </div>
</div>
<div class="modal inmodal" id="qrcode-modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated flipInY">
            <div class="modal-header" style="padding: 20px 10px;">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h5 class="modal-title">报名地址</h5>
            </div>
            <div class="modal-body" style="overflow: auto; height: 450px;">
                <div style="padding-bottom:5%;text-align: center;">
                    扫码进入官网
                </div>
                <div id="qrcode" style="text-align: center;">
                </div>
                <div style="padding-top:5%;text-align: center;">
                    电脑端报名地址:<a href="${webServer}/html/index.html?org_id=${org.organizationId}" target="_blank"><input type="text" style="cursor: pointer;" id="sign-link" value="${webServer}/html/index.html?org_id=${org.organizationId}"/></a>
                    <button id="copy-link">复制</button>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<script src="${ctx }/js/plugins/qrcode/jquery.qrcode.min2.js"></script>
<script src="${ctx }/js/plugins/qrcode/utf.js"></script>
<script type="text/javascript">
    $(function(){
        //组委会logo路径
        var _org_img = '${org.organizationLogo}'
        var imgServer ='${imgServer}'

        if(_org_img!=""){
            //http://img1.lwjjkgl.cn/7517061517311722?imageView2/1/w/48/h/48
            var org_logo=imgServer.concat('/').concat(_org_img).concat('?imageView2/1/w/48/h/48');
            $("#org_logo").attr("src",org_logo);
        }else {
            $("#org_logo").attr("src",'${ctx}/img/zgjky.jpg');
        }
        toastr.options = {
            closeButton: true,
            progressBar: true,
            showMethod: 'slideDown',
            timeOut: 4000
        };

        $('#side-menu').metisMenu();
        // Minimalize menu
        $('.navbar-minimalize').click(function () {
            $("body").toggleClass("mini-navbar");
            SmoothlyMenu();

        });
        function SmoothlyMenu() {
            if (!$('body').hasClass('mini-navbar') || $('body').hasClass('body-small')) {
                // Hide menu in order to smoothly turn on when maximize menu
                $('#side-menu').hide();
                // For smoothly turn on menu
                setTimeout(
                    function () {
                        $('#side-menu').fadeIn(400);
                    }, 200);
            } else if ($('body').hasClass('fixed-sidebar')) {
                $('#side-menu').hide();
                setTimeout(
                    function () {
                        $('#side-menu').fadeIn(400);
                    }, 100);
            } else {
                // Remove all inline style from jquery fadeIn function to reset menu state
                $('#side-menu').removeAttr('style');
            }
        }

        /*简单菜单选中*/
        $('#side-menu a').each(function(){
            var _href = $(this).attr('href');
            var _path_name = window.location.pathname;
// 		var _psub = window.location.pathname.substring(_href.length);
// 		var next_d = _psub.indexOf('/');
// 		var _is_p = false;
// 		if(_href.endWith('/')){
// 			if(next_d > 0){
// 				_is_p = true;
// 			}
// 		}else if(next_d >= 0){
// 			_is_p = true;
// 		}
            if(_path_name.startsWith(_href)){
                var _path_end = _path_name.replace(_href,'');
                var reg = /^.*[0-9]+.*$/;
                if(reg.test(_path_end) || _path_end == ''){
                    $(this).parent('li').addClass('active');
                    var _pul = $(this).parents('.nav-second-level');
                    if(_pul.length > 0){
                        _pul.addClass('in');
                        _pul.parent().addClass('active');
                    }
                }
            }
        });

        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });

        /* $('.wsc-logout-btn').bind('click',function(){
         $('#logout-form').submit();
         }); */

        /*serializeJson*/
        (function($){
            $.fn.serializeJson=function(){
                var serializeObj={};
                var array=this.serializeArray();
                var str=this.serialize();
                $(array).each(function(){
                    if(serializeObj[this.name]){
                        if($.isArray(serializeObj[this.name])){
                            serializeObj[this.name].push(this.value);
                        }else{
                            serializeObj[this.name]=[serializeObj[this.name],this.value];
                        }
                    }else{
                        serializeObj[this.name]=this.value;
                    }
                });
                return serializeObj;
            };
        })(jQuery);
    });
    //生成报名二维码
    function openQrcode(){
        $('#qrcode-modal').modal('show');
        var uri_address = '${webServer}';
        $('#qrcode').empty();
        $('#qrcode').qrcode({
            render : "canvas",
            text:uri_address+'/html/index.html?org_id=${org.organizationId}',
            background : "#ffffff",       //二维码的后景色
            foreground : "#000000",        //二维码的前景色
            src:'${org.organizationLogo}'
        });
    }

    //复制链接内容
    function copyArticle(event) {
        var target=document.getElementById("sign-link");
        target.select(); // 选择文本
        document.execCommand("copy");
        toastr.success('复制成功');
    }
    //点击复制按钮
    document.getElementById('copy-link').addEventListener('click', copyArticle, false);
    //登出方法
    function logout(){
        var token = getCookie("user_token");
        $(location).attr("href","${manageServer}/logout?"
            +"token="+token);
    }
</script>
<!-- scripts -->
<sitemesh:write property='div.scripts'/>

</body>

</html>